package cn.sm1234.domain;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Min;

public class User {
    /*
    * @Length长度
    * @Min
    * @Max
    * @NotBlank  会忽略首尾空格
    * @NotEmpty 不会忽略空格
    * @Email
    * */
    private Integer id;

    @NotBlank
    private String name;

    @NotBlank(message = "密码不能为空")
    @Length(min = 4, max=10, message = "4至10字符")
    private String password;

    @Min(value = 3, message = "不得小于0")
    private Integer age;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", age=" + age +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
